<template>
  <div>
    <div ref="pieChart" style="height: 285px;" />
  </div>
</template>

<script>
import * as echarts from 'echarts'
import { PartnerLocationAPI } from '@/api/SummaryInformation'
export default {
  name: 'PieChart',

  data() {
    return {
      pieChartData: []
    }
  },
  created() {
  },
  mounted() {
    this.getPieChart()
  },

  methods: {
    async  getPieChart() {
      const res = await PartnerLocationAPI()
      this.pieChartData = res.data
      const myChart = echarts.init(this.$refs.pieChart)
      const option = {
        title: {
          left: 'center'
        },
        tooltip: {
          trigger: 'item'
        },

        series: [
          {
            name: this.pieChartData.forEach(item => item.name),
            type: 'pie',
            radius: '70%',
            data: this.pieChartData,
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      }
      option && myChart.setOption(option)
    }

  }
}
</script>

<style lang="scss" scoped>

</style>
